package com.example.binpacking.service.Impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.binpacking.mapper.QuestionnaireNameMapper;
import com.example.binpacking.mapper.SubjectViewMapper;
import com.example.binpacking.model.QuestionnaireName;
import com.example.binpacking.model.SubjectView;
import com.example.binpacking.service.QuestionnaireNameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
@Service
    public class QuestionnaireNameServiceImpl extends ServiceImpl<QuestionnaireNameMapper, QuestionnaireName> implements QuestionnaireNameService {
    @Autowired
    private QuestionnaireNameMapper questionnaireNameMapper;
    @Override
    public Page<QuestionnaireName> getQuestionnaireNameByPage(BigDecimal isdeleted, int current, int size) {
        return questionnaireNameMapper.selectNameByIsdeleted(new Page<>(current, size), isdeleted);
    }

//    @Override
//    public boolean updateNameById(BigDecimal id, QuestionnaireName questionnaireName) {
//        return lambdaUpdate().eq(QuestionnaireName::getId, id).update(questionnaireName);
//    }
//
//    @Override
//    public boolean updateIsdeletedById(BigDecimal id, QuestionnaireName questionnaireName) {
//        return lambdaUpdate().eq(QuestionnaireName::getId, id).update(questionnaireName);
//    }

    @Override
    public int updateByName(BigDecimal id, String name) {
        return questionnaireNameMapper.updateByName(id,name);
    }

    @Override
    public int updateDeletedById(BigDecimal id, BigDecimal isdeleted) {
        return questionnaireNameMapper.updateDeletedById(id,isdeleted);
    }


}
